#include"UdpServer.hpp"
#include"dict.hpp"
#include<memory>

//./UdpServer ip port
std::string hander(std::string str)
{
    return "进入了翻译模块！";
}
using namespace USV;
int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        std::cerr<<"Usage:"<<argv[0]<<"port"<<std::endl;
        return 1;
    }
    uint16_t port=std::stoi(argv[1]);
    dict mydict;
    mydict.LoadDict();
    std::unique_ptr<UdpServer> usvr=std::make_unique<UdpServer>(port,[&mydict](std::string word)->std::string{
        return mydict.Translate(word);
    });
    usvr->Init();
    usvr->Start();

    return 0;
}